# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgbase=qca
pkgname=(qca-qt5 qca-qt6)
pkgver=2.3.6
pkgrel=2
pkgdesc='Qt Cryptographic Architecture'
arch=(x86_64)
url='https://userbase.kde.org/QCA'
license=(LGPL)
optdepends=('pkcs11-helper: PKCS-11 plugin' 'botan: botan plugin')
makedepends=(cmake doxygen pkcs11-helper botan qt5-base qt6-5compat)
source=(https://download.kde.org/stable/$pkgbase/$pkgver/$pkgbase-$pkgver.tar.xz{,.sig})
sha256sums=('ee59d531d4b82fb1685f4d8d74c2caa0777f501800f7426eaa372109a4305249'
            'SKIP')
validpgpkeys=(CB9387521E1EE0127DA804843FDBB55084CC5D84) # Harald Sitter <sitter@kde.org>

build() {
  cmake -B build-qt5 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTS=OFF \
    -DQCA_INSTALL_IN_QT_PREFIX=ON \
    -DQCA_MAN_INSTALL_DIR=/usr/share/man
  cmake --build build-qt5

  cmake -B build-qt6 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQT6=ON \
    -DBUILD_TESTS=OFF \
    -DQCA_INSTALL_IN_QT_PREFIX=ON \
    -DQCA_MAN_INSTALL_DIR=/usr/share/man
  cmake --build build-qt6
}

package_qca-qt5() {
  depends=(qt5-base nss ca-certificates)
  conflicts=(qca)
  provides=(qca)
  replaces=(qca)

  DESTDIR="$pkgdir" cmake --install build-qt5
}

package_qca-qt6() {
  depends=(qt6-5compat nss ca-certificates)

  DESTDIR="$pkgdir" cmake --install build-qt6
}
